import requests
import config


# 创建接口类
class OrrderAPI:
    # def __init__(self):
    #     self.url_select= config.BASE_URL + "/api/v1/order/{}"

    def get(self):
        return requests.get(url="http://e.cn/api/v1/order/by_user?page=1", headers={"token": f'{config.TOKEN}'})

    def add(self, add_data):
        return requests.post(url="http://e.cn/api/v1/order", headers={"token": f'{config.TOKEN}'}, json=add_data)

    def select(self, order_id):
        # return requests.get(url=self.url_select.format(order_id), headers={"token": f'{config.TOKEN}'})
        return requests.get(url=config.BASE_URL + "/api/v1/order/{}".format(order_id), headers={"token": f'{config.TOKEN}'})


# [pytest]
# addopts = -s --html=report/index.html
# testpaths = ./scripts  代码 存放的路径
# python_files = test*.py  定义文件的规则
# python_classes = Test*    定义类的规则
# python_functions = test*   定义方法的规则

